package com.sikaryofficial.system.api.factory;

import com.sikaryofficial.common.core.domain.R;
import com.sikaryofficial.system.api.OuterNetWorkbenchService;
import com.sikaryofficial.system.api.domain.SysUser;
import com.sikaryofficial.system.api.domain.order.OrderCustomizedOpReq;
import com.sikaryofficial.system.api.model.FileInfo;
import com.sikaryofficial.system.api.model.outer.OrderPayInfoResp;
import com.sikaryofficial.system.api.model.outer.UploadPaymentVoucherReq;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

public class OuterNetWorkbenchFallbackFactory implements FallbackFactory<OuterNetWorkbenchService> {
    @Override
    public OuterNetWorkbenchService create(Throwable cause) {
        return new OuterNetWorkbenchService() {
            @Override
            public R<String> getCustomerContractUrl(Long orderHeaderId) {
                return R.fail("get customer contract url fail, cause: " + cause.getMessage());
            }

            @Override
            public R<OrderPayInfoResp> getPayInfo(Long orderHeaderId, Integer payType) {
                return R.fail("get pay info fail, cause: " + cause.getMessage());
            }

            @Override
            public R<Boolean> uploadPaymentVoucher(UploadPaymentVoucherReq req) {
                return R.fail("upload payment voucher fail, cause: " + cause.getMessage());
            }

            @Override
            public R<List<FileInfo>> getShipmentFile(Long orderHeaderId) {
                return R.fail("get shipment file fail, cause: " + cause.getMessage());
            }

            @Override
            public R<String> upload(MultipartFile file) {
                return R.fail("upload file fail, cause: " + cause.getMessage());
            }

            @Override
            public R<Void> confirmOrderCustomized(OrderCustomizedOpReq opReq) {
                return R.fail("confirm order customized fail, cause: " + cause.getMessage());
            }

            @Override
            public R<SysUser> getSalesPhone(Long customerUserId){
                return R.fail("get sales phone number fail, cause: " + cause.getMessage());
            }
        };
    }
}
